const express = require('express');
const cors = require('cors');
const fs = require('fs');
const path = require('path');

const app = express(); // 创建Express应用实例


// 使用cors中间件，允许所有域名访问
app.use(cors());

// 配置JSON解析中间件
app.use(express.json());

// 引入并使用product路由
const productRoutes = require('./routes/product');
app.use('/product', productRoutes);

// 启动服务器
const port = 3000;
app.listen(port, () => {
    console.log(`Server is running at http://localhost:${port}`);
});
